/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication9;
import org.jgap.Chromosome;
import org.jgap.Configuration;
import org.jgap.FitnessFunction;
import org.jgap.Gene;
import org.jgap.Genotype;
import org.jgap.IChromosome;
import org.jgap.impl.DefaultConfiguration;
import org.jgap.impl.IntegerGene;
import org.jgap.impl.StringGene;
/**
 *
 * @author claudio
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        calculoMejorRuta prueba = new calculoMejorRuta(null);
        prueba.calcularRuta(1, 5, 10, 14);
    }

    public String getCadena(IChromosome cromosoma) {
        String result = "";

        int length = cromosoma.size();
        for (int i = 0; i < length; i++) {
            result += (String) cromosoma.getGene(i).getAllele();
        }

        return result;
    }

    public static void getPenalizacionRuta(String ruta) {
        int suma_x=0;
        int suma_y=0;
        int tamano = ruta.length();
        for(int i = 0; i < tamano; i++) {
            char paso = ruta.charAt(i);
            switch (paso) {
                case 'A':
                    suma_x++;
                    break;
                case 'B':
                    suma_y++;
                    break;
                case 'C':
                    suma_x--;
                    break;
                case 'D':
                    suma_y--;
                    break;
            }
            
        }
        System.out.println("Suma X:" + suma_x);
            System.out.println("Suma Y:" + suma_y);
    }
}
